from pandas import DataFrame

from src.backend.beanfactory import BeanFactory
from src.backend.entity.manager import ClassRoom


def fetch_classroom()->DataFrame:
    sql = "select c.date,t.name time_period,c.student from classroom c \
    LEFT JOIN time_period t on c.time_period=t.id \
    "
    df = BeanFactory.getCursor().query(sql)
    return df

def add_classroom(classroom:ClassRoom)->str:
    BeanFactory.getCursor().insert(classroom)

    return fetch_classroom()